package com.lu.controller;


import com.lu.pojo.User;
import com.lu.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class UserController {
    @Resource
    private UserService userService;
    @GetMapping("/getUser/{uaccount}/{upwd}")
    public List<User> getUser(@PathVariable("uaccount") String uaccount, @PathVariable("upwd") String upwd){
        return userService.getUser(uaccount, upwd);
    }
    @PostMapping("/setUser/{uname}/{upwd}/{uage}")
    public List<User> setUser(@PathVariable("uname") String uname, @PathVariable("upwd") String upwd, @PathVariable("uage") String uage){
       return userService.setUser(uname,upwd,uage);
    }
    @GetMapping("/getUser2/{uid}")
    public List<User> getUser(@PathVariable("uid")int uid){
        return userService.getUser2(uid);
    }

    @GetMapping("/getUserAdd/{uaccount}")
    public List<User> getUser(@PathVariable("uaccount")String uaccount){
        return userService.getUserAdd(uaccount);
    }
}
